package com.project.springboot.utils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

/**
 * Description：JSON序列化工具类
 * Created by 朱正磊 on 2019-03-17 22:17
 */
public class JsonUtil {

    /**
     * description：对象转json字符串（格式化）
     * user 朱正磊
     * time 2019/3/18 0018 下午 2:51
     * @param object
     * @return
     */
    public static String toJson(Object object) {
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setPrettyPrinting();
        Gson gson = gsonBuilder.create();
        return gson.toJson(object);
    }

}
